-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add lazy import for different routes #656
Conversation
- imported routes from lazy imports - added suspense wrapper around all pages
- when file is still loading data wont be there. so added the check if its is not null in opportunities.tsx
@alexfauquette I tested this in my local machine with the hosted website! it worked :)!! But i was thinking that we should probably add tests to make sure things are not breaking while improving the code base. |
Hi, Effectively having tests to ensure all games are still working could be nice. But for now, there is nothing so it's to build from scratch About reducing the bundle size, you might be interested by the |
When I build it made chunks of js files! and webpack does make chunks of js files when using react lazy imports (ref: https://uploadcare.com/blog/lazy-loading-in-webpack/) |
So should I close this pr ? |
I tested it too and it's fine so we can merge it if you want, but I struggle to understand the benefit.
It seems that if you don't use the webpack config (run @VaiTon would you have an opinion on this topic? |
I am not sure either, |
I think there is a problem about having react-scripts and webpack. The I recommend removing the other command. |
In the long run I'd recommend switching to Vite too |
Ok so I read again the webpack file, and it appears that it takes the chunks and output a bundle.min.js, which is then unused. From the README
|
I've created #657 for the webpack issue |
Also, for me this branch run with
|
Yes, I think the "facilitate integration in OFF main site" was an initial idea that never got implemented @teolemon could you confirm the main website does not show directly hunger games? |
The only thing left: https://world.openfoodfacts.org/hunger-game |
Yess the tooling is next level, and also hmr is great ! Makes development process great ! If we are moving from webpack to vite there is a plugin for migration: https://github.com/originjs/webpack-to-vite |
Ok, I don't know that much about this framework, I assume it's similar to NextJS Should we close this PR and open a new one with vite? |
@alexfauquette we could still use lazy loading. So we could merge this and then I'll open a PR to use Vite. |
What
Screenshot
Build Results